#!/usr/bin/ruby
require 'rubygems'
require 'scrapi'


SERVER = ARGV[0]

if SERVER.nil?
  exit
end

status = Scraper.define do
  process "dt:nth-child(6)", :cpu_usage => :text
  process "dt:nth-child(7)", :nb_requests => :text
  result :cpu_usage, :nb_requests
end

server_status = status.scrape(URI.parse("http://#{SERVER}/server-status"))

puts SERVER
puts Time.now.to_s
puts server_status.cpu_usage
puts server_status.nb_requests

